package com.kuangstudy.io.test;

import java.io.*;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Map;

/**
 * ClassName: UnsafeBuyTicket
 * date: 2021/07/16 18:40:33
 *
 * @author zlk
 */
public class Demo1 {
    public static void main(String[] args) throws IOException {
        HashMap<String, String> map = new HashMap<>();
        BufferedReader br = new BufferedReader(new FileReader("e:\\a.txt"));
        BufferedWriter bw = new BufferedWriter(new FileWriter("e:\\b.txt"));
        String line;
        int i = 0;
        while ((line = br.readLine())!=null){
            String[] split = line.split("\\.");
            map.put(split[0],split[1]);
        }
        System.out.println(map.toString());
        for (Map.Entry<String, String> entry : map.entrySet()) {
            String key = entry.getKey();
            String value = entry.getValue();
            line = key + "." + value;
            bw.write(line);
            bw.newLine();
        }
        bw.close();
        br.close();
    }
}
